<template>
	<view>
		<u-popup :show="show" mode="bottom" closeable @close="close">
			<view class="box padding margin-bottom-xl">
				<view class="text-center text-lg">请选择支付方式</view>
				<view class="margin-top text-center pay-price">
					<text class="text-red">¥</text>
					<text class="text-red padding-left-money">12.80</text>
				</view>
				<view class="cu-list menu margin-top">
					<view class="cu-item solid-bottom">
						<view class="content padding-tb-sm">
							<view class="pay-icon">
								<image src="@/static/image/order/balance.png" mode=""></image>
								<text class="padding-left-xs">余额支付</text>
								<text class="text-gray">（余额：¥996.20）</text>
							</view>
						</view>
						<view class="action">
							<u-radio-group v-model="selectedOption">
							  <u-radio :name="10" activeColor="var(--theme-color)"></u-radio>
							</u-radio-group>
						</view>
					</view>
					<view class="cu-item">
						<view class="content padding-tb-sm">
							<view class="pay-icon">
								<image src="@/static/image/order/wepay.png" mode=""></image>
								<text class="padding-left-xs">微信支付</text>
							</view>
						</view>
						<view class="action">
							<u-radio-group v-model="selectedOption">
							  <u-radio :name="20" activeColor="var(--theme-color)"></u-radio>
							</u-radio-group>
						</view>
					</view>
				</view>
				<view class="submit">
					<view class="flex flex-direction">
						<button class="cu-btn china-btn-bg lg round"  @click="submit()">确认支付</button>
					</view>
					<!-- <u-button type="success" size="normal" @click="submit()">确认支付</u-button> -->
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		props: {
			show: {
				type: Boolean,
				default: false,
			},
			cost: {
				type: [String, Number],
				default: '',
			},
			source: {
				type: String,
				default: '',
			},
			referParams:{
				type: Object,
				default: () => {},
			}
		},
		data() {
			return {
				selectedOption:10,
				userWallet:[]
			};
		},
		created() {
		},
		methods:{
			submit(){
				let source = this.source;
				uni.showLoading({
					title:'请等待'
				})
				if(source=='partner'){
					this.sendPartner()
				}else if(source == 'orderAdd'){
					this.sendTable();
				}
			},
			close(e){
				this.$emit('payCallBack',{type:'colse',data:'error'})
			},
			//延长服务
			sendTable(){
				let self = this;
				let params = self.referParams;
				params.payType = self.selectedOption;
				uni.navigateTo({
					url:'/pages/table/payment/result?source=addOrder&orderId='+res.data.order.order_id
				})
			},
			
			// 预约技师
			sendPartner(){
				let self = this;
				let params = self.referParams;
				params.pay_type = self.selectedOption;
				uni.redirectTo({
					url:'/pages/order/payment/payment?source=partner&orderId=1'
				})
			}
		}
	}
</script>

<style lang="less">
.box{
	height: 32vh;
	.pay-price{
		font-size: 49upx;
	}
	.pay-icon{
		image{
			width: 60upx;
			height: 60upx;
		}
	}
	.submit{
		width: 90%;
		margin:30upx auto;
	}
}
.padding-left-money{
	padding-left: 4upx;
}
.u-popup {
  position: absolute !important;
}
</style>
